/**
 * 上海中赢金融信息服务有限公司
 * Copyright (c) 2017-2027 Chinazyjr,Inc.All Rights Reserved.
 */
package com.sys.midware.mongo.core.handler;

import com.sys.midware.logger.Logger;
import com.sys.midware.logger.LoggerFactory;

/**
 * 
 * <b>ClassName：</b> HBaseDBFactory <br/>
 * <b>Description：</b> TODO <br/>
 * <b>@author：</b> mobing <br/>
 * <b>@date：</b> 2015年10月26日 下午3:40:39 <br/>
 * <b>@version: </b>  <br/>
 */
public class MongoDBFactory {
    private static final Logger logger = LoggerFactory.getLogger(MongoDBFactory.class);

    private static MongoDBFactory facotry = new MongoDBFactory();

    private MongoDBFactory() {
    }

    public static MongoDBFactory createFactory() {
        return facotry;
    }

    public IMongoDBHandler getDBHandler(Object instance,Object key) throws Exception {
        if (key instanceof String) {
            return new MongoDBHandler2X((String) instance,(String) key);
        } else
            logger.equals("getDBHandler fail");
            throw new IllegalArgumentException("arugument key is not String :" + key.getClass().getName());
    }

    public void shutdown() throws Exception {
        facotry = null;
    }

}
